package com.liu;

import com.config.Dbconfig;
import com.liu.service.UserService;
import org.springframework.boot.SpringApplication;
import org.springframework.boot.autoconfigure.SpringBootApplication;
import org.springframework.context.ConfigurableApplicationContext;
import org.springframework.context.annotation.Import;
import org.springframework.context.annotation.ImportResource;

@SpringBootApplication
@ImportResource("classpath:beans.xml") //将配置文件导入当前环境
@Import(Dbconfig.class)  //导入其他配置类,导入到当前环境
public class Sb03ImportApplication {

    public static void main(String[] args) {
        ConfigurableApplicationContext context = SpringApplication.run(Sb03ImportApplication.class, args);
        UserService userService = context.getBean("userService", UserService.class);
        userService.save();
    }

}
